﻿@model COMCMS.Core.AdminMenu
@{
    ViewBag.title = "查看/编辑后台菜单";
}
<div class="wrapper wrapper-content ">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>@ViewBag.Title</h5>
            <div class="ibox-tools">
            </div>
        </div>
        <div class="ibox-content">
            @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editAdminMenuForm", @class = "form-horizontal m-t" }))
            {
                <div class="form-group">
                    <label class="col-sm-3 control-label">上级菜单：</label>
                    <div class="col-sm-8">
                        <select class="form-control m-b" name="PId" id="PId" asp-for="PId">
                            <option value="0">一级菜单</option>
                            @foreach (var m in ViewBag.ListTree)
                            {
                                <option value="@m.Id">@m.MenuName</option>
                            }
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">菜单名称：</label>
                    <div class="col-sm-8">
                        <input id="MenuName" name="MenuName" minlength="2" maxlength="50" type="text" class="form-control" required aria-required="true" placeholder="请输入一个菜单名字，如：文章列表" value="@Model.MenuName">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">菜单标识：</label>
                    <div class="col-sm-8">
                        <input id="MenuKey" type="text" class="form-control" name="MenuKey" placeholder="菜单唯一标识，只支持英文加数字，如：addarticle" required aria-required="true" minlength="3" value="@Model.MenuKey">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">连接地址：</label>
                    <div class="col-sm-8">
                        <input id="Link" type="text" class="form-control" name="Link" value="@Model.Link" maxlength="200" placeholder="请填写一个链接地址如：/Admin/Index/Main" required aria-required="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">排序：</label>
                    <div class="col-sm-8">
                        <input id="Rank" type="number" class="form-control" name="Rank" value="@Model.Rank" maxlength="20" placeholder="越小排得越前" aria-required="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">隐藏菜单：</label>
                    <div class="col-sm-8">
                        <label class="checkbox-inline i-checks">
                            <input type="checkbox" value="1" name="IsHide" id="IsHide" @(Model.IsHide == 1 ? "checked = \"checked\"" : "")> 隐藏菜单（菜单不显示且不可用）
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label">样式名称：</label>
                    <div class="col-sm-8">
                        <input id="ClassName" type="text" class="form-control" name="ClassName" value="@Model.ClassName" maxlength="20" placeholder="您可以填写一个样式名称" aria-required="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">权限详情：</label>
                    <div class="col-sm-8">
                        @foreach (var e in ViewBag.ListEvent)
                        {
                            <label class="checkbox-inline i-checks">
                                <input type="checkbox" name="eventkey" id="eventkey_@e.Id" value="@e.Id"
                                       @if (Model.ListEvent != null && Model.ListEvent.Count > 0) { if (Model.ListEvent.FirstOrDefault(s => s.EventId == e.Id) != null) { @: checked="checked"
                                       } }> <i></i> @e.EventName
                                </label>
                            }
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-3">
                        <input type="hidden" value="@Model.Id" id="Id" name="Id" />
                        <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
                        <button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
                    </div>
                </div>
            }
        </div>
    </div>


</div>
<script>
    $(function () {
        DoPost("editAdminMenuForm");
    })
</script>
